package com.ruoyi.crm.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.crm.domain.Clue;
import com.ruoyi.crm.domain.vo.ClueTrackVo;
import com.ruoyi.crm.service.IClueService;
import com.ruoyi.system.domain.vo.MongoLogSearchVo;
import com.ruoyi.system.service.IMongoLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.LinkedHashMap;
import java.util.List;

@RestController
@RequestMapping("/crm/mongolog")
public class MongLogController extends BaseController {
    @Resource
    private IMongoLogService iMongoLogService;
    @Resource
    IClueService iClueService;
    @PreAuthorize("@ss.hasPermi('crm:track:list')")
    @GetMapping("/list")
    public TableDataInfo list(MongoLogSearchVo searchVo) {
        startPage();
        List<LinkedHashMap> list = iMongoLogService.list(searchVo);
        TableDataInfo dataTable = getDataTable(list);
        return getDataTable(list);
    }
    //捞取
    @PreAuthorize("@ss.hasPermi('crm:track:laoqu')")
    @PostMapping("/laoqu/{id}")
    public AjaxResult laoqu(@PathVariable Long id) {
        return toAjax(iClueService.restClue(id));
    }

    //伪线索

}
